package com.sxyc.tintin.model;


import java.util.List;

import com.jfinal.plugin.activerecord.Model;

public class Address extends Model<Address> {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2816643239270717701L;

	public static final Address dao = new Address();

	// 使用jFinal 日志
	private com.jfinal.log.Log log = com.jfinal.log.Log.getLog(this.getClass());

	public Address getUserByOpenId(String openId) {
		System.out.println("select * from address where openId = '"+openId+"'");
		return Address.dao.findFirst("select * from address where openId = '"+openId+"' and cat=0 ORDER BY id desc");
	}
	
	public Address getUserByOpenId2(String openId) {
		System.out.println("select * from address where openId = '"+openId+"'");
		return Address.dao.findFirst("select * from address where openId = '"+openId+"' and cat=1 ORDER BY id desc");
	}
	
	public WxUser getIdByOpenId(String openId) {
		return WxUser.dao.findFirst("select * from wx_user where openId = '"+openId+"' ");
	}
	public List<Address> history(String openId,int cat,int status){
		return Address.dao.find("select * from address where openId=? and cat=? and status=?",new Object[]{openId,cat,status});
		
	}
}
